#include <stdio.h>
#include "binn.h"

struct P {
    char* name;
    int i;
    float f;
};

void to_binn(void* out, struct P p) {
    binn_object_set_str(out, "name", p.name);
    binn_object_set_int32(out, "i", p.i);
    binn_object_set_float(out, "f", p.f);
}
void from_binn(void* in, struct P* p) {
    p->name = binn_object_str(in, "name");
    p->f = binn_object_float(in, "f");
    p->i  = binn_object_int32(in, "i");
}
void proc(void* in, void* out) {
    struct P p;
    from_binn(in, &p);
    p.name = "asv";
    p.i = p.i + 10;
    p.f = p.f * 2;
    to_binn(out, p);
}
